def main():
first_in = [int(i) for i in input().split(" ")]
num_seats = first_in[2]
rows = [[]] * first_in[0]
for i in range(0, first_in[0]):
rows[i] = list(input())
print(traverse_all(rows, num_seats))
def traverse_all(rows, target):
transposed_rows = zip(*rows)
counter = 0
counter += traverse(rows, target)
if target > 1:
counter += traverse(transposed_rows, target)
return counter
def traverse(rows, target):
counter = 0
for row in rows:
consecutive_seats = "".join(row).split("*")
for seat in consecutive_seats:
seat_len = len(seat)
if seat_len >= target:
counter += 1 + (seat_len - target)
return counter
if __name__ == '__main__':
main()
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll test,h,p,i,j,s,xy,n,flag=0,u,count,d,o1=0,o2=0,e,l,r,x,y,m,z,max1,x1,y1,k,x2,y2,z1,z2,sum,min1;
cin>>n>>m>>k;
vector<string>a(n);
for(i=0;i<n;i++){
cin>>a[i];
}
count=0;
vector<vector<ll>>left(n,vector<ll>(m,0)),up(n,vector<ll>(m,0));
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(a[i][j]=='.'){
left[i][j]++;
up[i][j]++;
if(i){
up[i][j]+=up[i-1][j];
}
if(j){
left[i][j]+=left[i][j-1];
}
if(k==1){
count++;
continue;
}
}
if(left[i][j]>=k){
count++;
}
if(up[i][j]>=k){
count++;
}
}
}
cout<<count<<"\n";
return 0;
}
1721A - Image | 1180C - Valeriy and Deque |
557A - Ilya and Diplomas | 1037D - Valid BFS |
1144F - Graph Without Long Directed Paths | 1228A - Distinct Digits |
355B - Vasya and Public Transport | 1230A - Dawid and Bags of Candies |
1530A - Binary Decimal | 1472D - Even-Odd Game |
441C - Valera and Tubes | 1328E - Tree Queries |
265A - Colorful Stones (Simplified Edition) | 296A - Yaroslav and Permutations |
967B - Watering System | 152A - Marks |
1398A - Bad Triangle | 137A - Postcards and photos |
1674D - A-B-C Sort | 334A - Candy Bags |
855A - Tom Riddle's Diary | 1417A - Copy-paste |
1038A - Equality | 1061A - Coins |
1676E - Eating Queries | 1447A - Add Candies |
1721D - Maximum AND | 363C - Fixing Typos |
1401A - Distance and Axis | 658A - Bear and Reverse Radewoosh |